package com.hualude.roadsign.service.impl;

import com.hualude.roadsign.dto.*;
import com.hualude.roadsign.repository.*;
import com.hualude.roadsign.service.RoadSignMapService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by xu-jiaHui on 2017/4/22.
 */
@Service
public class RoadSignMapServiceImpl implements RoadSignMapService {

    @Resource
    private RoadPoleRepository roadPoleRepository;

    @Resource
    private SolarEnergyRepository solarEnergyRepository;

    @Resource
    private SignalMachineRepository signalMachineRepository;

    @Resource
    private SignalLampRepository signalLampRepository;

    @Resource
    private MonitorRepository monitorRepository;

    @Resource
    private CoverRepository coverRepository;

    @Resource
    private HighLeverRepository highLeverRepository;

    @Resource
    private RoadLineRepository roadLineRepository;

    @Resource
    private GuardrailRepository guardrailRepository;


    public List<RoadpoleDto> getRoadPoleCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return roadPoleRepository.getRoadPoleCoordinate4Map(orgId, orgType, actorId);
    }

    public List<RoadpoleDto> getRoadPoleByXY(String longitude, String latitude) throws Exception {
        return roadPoleRepository.getRoadPoleByXY(longitude, latitude);
    }

    @Override
    public List<SolarEnergyDto> getSolarEnergyCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return solarEnergyRepository.getSolarEnergyCoordinate4Map(orgId, orgType, actorId);
    }

    @Override
    public List<SignalMachineDto> getSignalMachineCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return signalMachineRepository.getSignalMachineCoordinate4Map(orgId, orgType, actorId);
    }

    @Override
    public MapInfoDto getSolarEnergyInfoByXY(String longitude, String latitude) throws Exception {
        return solarEnergyRepository.getSolarEnergyInfoByXY(longitude, latitude).get(0);
    }

    @Override
    public MapInfoDto getSignalMachineInfoByXY(String longitude, String latitude) throws Exception {
        return signalMachineRepository.getSignalMachineInfoByXY(longitude, latitude).get(0);
    }

    @Override
    public MapInfoDto getRoadPoleInfoByXY(String longitude, String latitude) throws Exception {
        return roadPoleRepository.getRoadPoleInfoByXY(longitude, latitude).get(0);
    }


    @Override
    public List<SignalLampDto> getSignalLampCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return signalLampRepository.getSignalLampCoordinate4Map(orgId, orgType, actorId);
    }

    @Override
    public List<MonitorDto> getMonitorCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return monitorRepository.getMonitorCoordinates4Map(orgId, orgType, actorId);
    }

    @Override
    public List<CoverDto> getCoverCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return coverRepository.getCoverCoordinates4Map(orgId, orgType, actorId);
    }

    @Override
    public List<HighLeverDto> getHighLeverCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return highLeverRepository.getHighLeverCoordinates4Map(orgId, orgType, actorId);
    }

    @Override
    public List<RoadLineDto> getRoadLineCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return roadLineRepository.getRoadLineCoordinates4Map(orgId, orgType, actorId);
    }

    @Override
    public MapInfoDto getSignalLampInfoByXY(String longitude, String latitude) throws Exception {
        return signalLampRepository.getSignalLampInfoByXY(longitude, latitude);
    }

    @Override
    public MapInfoDto getMonitorInfoByXY(String longitude, String latitude) throws Exception {
        return monitorRepository.getMonitorInfoByXY(longitude, latitude);
    }

    @Override
    public MapInfoDto getCoverInfoByXY(String longitude, String latitude) throws Exception {
        return coverRepository.getCoverInfoByXY(longitude, latitude);
    }

    @Override
    public MapInfoDto getHighLeverInfoByXY(String longitude, String latitude) throws Exception {
        return highLeverRepository.getHighLeverInfoByXY(longitude, latitude);
    }

    @Override
    public MapInfoDto getRoadLineInfoById(Integer elementId) throws Exception {
        return roadLineRepository.getRoadLineInfoById(elementId);
    }

    @Override
    public MapInfoDto getGuardrailInfoById(Integer elementId) throws Exception {
        return guardrailRepository.getGuardrailInfoById(elementId);
    }

    @Override
    public List<GuardrailDto> getGuardrailCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        return guardrailRepository.getGuardrailCoordinates4Map(orgId, orgType, actorId);
    }
}
